package nci60.main
import nci60.data.connected.LeadingProtein
import nci60.data.maxquant.Project

/**
 * GRAILS <a href="http://grails.org/doc/latest/guide/theWebLayer.html#controllers" target="_blank">Controllers</a>
 * This controller is starting point for any visitor and just handles the Welcome page and the Download section.
 * For both actions almost no database interaction is needed.
 *
 * @autor <a href="mailto:Florian.J.Auer@googlemail.com">Florian J. Auer</a>
*/
class MainController {

    /**
     * Makes the Helper Service accessable
     * @see helper.HelperService
     */
    def helperService

    /**
     * Simply renders the Welcome (Home) page
     */
    def index() {
        Locale.setDefault(new Locale("US"));
        
    }

    
    /**
     * Gets the names and locations of the files in the download section from {@link nci60.administration.Params} and renders the Download page
     */
    def download() {
        def download = helperService.getParameters('download').download
        return [Files:download]
    }

    def help() {
        return [:]
    }
    


    static String mergeList(List list, String separator){
        def result = ''
        list.eachWithIndex{element,index->
            if(index==0){
                result = element
            }else{
                result = result+separator+element
            }
        }
        return result
    }

}
